#!/usr/bin/env python
#coding: utf-8
'''
Created on 2017年4月17日

@author: Administrator
'''
from comment.models import Comment
from common.templatetags.jinja2 import time_beauty

def get_comment_childrens(comment):
    data = []
    if isinstance(comment, Comment):
        for children in comment.children:
            record = {
                "first_name":children.user.first_name,
                "from_first_name":comment.user.first_name,
                "content":children.content,
                "create_time":time_beauty(children.create_time)
            }
            data.append(record)
            if children.children:
                data.extend(get_comment_childrens(children)) 
    return data
